﻿using Exam.infranstuctrue.Tools;
using Exam.infranstuctrue.Tools.Attributes;
using Newtonsoft.Json;
using ServiceStack.Redis;

namespace Exam.Service.Instance
{
    [IProvider, Iinjection]
    public class UserService
    {
        private readonly Session _session;
        private RedisClient Redis = new("101.43.203.224", 6379, "Change320532132@");

        public UserService(Session session )
        {
            _session = session;
        }

        public bool CheckLogin(string code)
        {
            var result = Http.Get( "http://101.43.203.224:5555/api/Admin/CheckLogin?code=" + code);
            var mycode = JsonConvert.DeserializeObject<MyCode>(result);
            return mycode!.code == 1 ? true : false;
        }
    }
    public class MyCode
    {
        public int code { get; set; }
    }
}
